<!-- 导航URL -->
<div class="row wrapper border-bottom white-bg page-heading">
	<div class="col-md-12">
		<ol class="breadcrumb">
			<li><a>主页</a></li>
			<li><a>活动查询</a></li>
			<li class="active"><strong>发行券查询</strong></li>
		</ol>
	</div>
</div>
<!-- 主要内容 -->
<div class="wrapper wrapper-content animated fadeIn" ng-app ng-controller="queryCuponCtrl">
	<form class="form-horizontal" id="form1">
			<div class="row">
				<div class="col-lg-12">
					<div class="">
						<div class="ibox float-e-margins">
							<div class="ibox-content">								
								<div class="form-group">
									<label class="col-sm-1 control-label">商户编号/名称：</label>
									<div class="col-sm-2">
										<input type="text" class="form-control" ng-model="info.merchantName" onchange="keyChange()">
									</div>
									<label class="col-sm-1 control-label">参与活动：</label>
									<div class="col-sm-2">
										<select class="form-control" ng-model="info.couponCode" ng-options="x.value as x.text for x in couponCodes">
							             </select>
									</div>
									<label class="col-sm-1 control-label">获得时间：</label>
									<div class="col-sm-5">
										<input id="d5221" class="form-control" type="datetime" ng-model="info.startTime" onchange=""  style="width:auto;display:inline-block;"
											   onFocus="var d5222=$dp.$('d5222');WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss',changed:verifyTime(1,'#d5221','#d5222',31,isVerifyTime),onpicked:function(){d5222.focus();},maxDate:'#F{$dp.$D(\'d5222\')||\'%y-%M-%d\'}'})"/>
										-
										<input id="d5222" class="form-control" type="datetime"  ng-model="info.endTime" onchange=""  style="width:auto;display:inline-block;"
											   onFocus="WdatePicker({skin:'whyGreen',dateFmt: 'yyyy-MM-dd HH:mm:ss',changed:verifyTime(2,'#d5221','#d5222',31,isVerifyTime),minDate:'#F{$dp.$D(\'d5221\')}',maxDate:'%y-%M-%d 23:59:59'})"/>
										<br/><span><font color="#999">备注：查询范围不能超过一个月</font></span>
									</div>
								</div>
								
								<div class="form-group">
									<label class="col-sm-1 control-label">商户手机号：</label>
									<div class="col-sm-2">
										<input type="text" class="form-control" ng-model="info.mobilephone" onchange="keyChange()">
									</div>
									<label class="col-sm-1 control-label">券编号：</label>
									<div class="col-sm-2">
										<input type="text" class="form-control" ng-model="info.couponNo" onchange="keyChange()">
									</div>
									<label class="col-sm-1 control-label">失效时间：</label>
									<div class="col-sm-5">
										<input id="d5223" class="form-control" type="datetime" ng-model="info.endStartTime" onchange="keyChange()"  style="width:auto;display:inline-block;"
										       onFocus="var d5224=$dp.$('d5224');WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',onpicked:function(){d5224.focus();},maxDate:'#F{$dp.$D(\'d5224\')||\'%y-%M-%d\'}'})"/>
										-
										<input id="d5224" class="form-control" type="datetime"  ng-model="info.endEndTime" onchange="keyChange()"  style="width:auto;display:inline-block;"
										       onFocus="WdatePicker({skin:'whyGreen',dateFmt: 'yyyy-MM-dd',minDate:'#F{$dp.$D(\'d5223\')}',maxDate:'%y-%M-%d'})"/>

									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-1 control-label">所属一级代理商：</label>
									<div class="col-sm-2">
							             <select name="autocomplete-select" id="autocomplete-select1" ng-model="info.oneAgentName" ng-options="x.value as x.text for x in oneAgent" style="width: 100%" chosen chosen-data="agent" chosen-keyup="getStates">
										</select>
									</div>
									<label class="col-sm-1 control-label">所属代理商：</label>
									<div class="col-sm-2">
										<select name="autocomplete-select" id="autocomplete-select2" ng-model="info.agentName" ng-options="x.value as x.text for x in agent" style="width: 100%" chosen chosen-data="agent" chosen-keyup="getStates">
										</select>
									</div>
									<label class="col-sm-1 control-label">购买金额：</label>
									<div class="col-sm-5">
										<input  class="form-control" type="text" ng-model="info.transAmountBeg"  style="width:auto;display:inline-block;"/>
										-
										<input  class="form-control" type="text"  ng-model="info.transAmountEnd" style="width:auto;display:inline-block;"/>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-1 control-label">赠送金额：</label>
									<div class="col-sm-5">
										<input   class="form-control" type="text" ng-model="info.giftAmountBeg"  style="width:auto;display:inline-block;"/>
										-
										<input   class="form-control" type="text"  ng-model="info.giftAmountEnd" style="width:auto;display:inline-block;"/>
									</div>
									<label class="col-sm-1 control-label">券编号：</label>
									<div class="col-sm-5">
										<input class="form-control" type="text" ng-model="info.couponNoBeg" onchange="keyChange()" style="width:auto;display:inline-block;"/>
										-
										<input class="form-control" type="text"  ng-model="info.couponNoEnd" onchange="keyChange()" style="width:auto;display:inline-block;"/>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-1 control-label">支付方式：</label>
									<div class="col-sm-2">
										<select class="form-control" ng-model="info.payMethod" ng-options="x.value as x.text for x in payMethodList">
											<option value="">全部</option>
										</select>
									</div>
									<label class="col-sm-1 control-label">券类型：</label>
									<div class="col-sm-2">
										<select class="form-control" ng-model="info.couponType" ng-change="couponTypeChange()" ng-options="x.value as x.text for x in couponTypeSelect">
										</select>
									</div>
									<label class="col-sm-1 control-label">子类型：</label>
									<div class="col-sm-2">
										<select class="form-control" ng-model="info.couponEntryType" ng-options="x.value as x.text for x in couponEntryTypes">
										</select>
									</div>
								</div>
								<div class="form-group">
									<div class="col-lg-12">
										<div class="col-sm-1"></div>
										<button class="btn btn-primary6 btn-mr20" type="button" id="btnSubmit" ng-click="query(2)">查询</button>
										<button class="btn btn-primary3 btn-mr20" type="button" ng-click="clear()" id="btnSubmit2">清空</button>
										<button class="btn btn-primary5 btn-mr20" ng-show="hasPermit('couponActivity.addActivityCoupon')" type="button" ng-click="addNewCoupon()" id="btnSubmit4">新增</button>
										<button class="btn btn-new btn-mr20" ng-show="hasPermit('couponActivity.addCouponImport')" type="button" ui-sref="activity.couponImport">批量新增券</button>
										<button class="btn btn-primary6 btn-mr20" ng-show="hasPermit('couponActivity.exportCoupon')" type="button" ng-click="export()" id="btnSubmit3">导出</button>
									</div>
								</div>
								
							</div>
						</div>

						<div class="ibox float-e-margins">
							<div class="ibox-content">
								<div class="form-group">
									<label class="col-sm-1 control-label">总计</label>
									<div class="col-sm-2 checkbox">购买金额：<span ng-bind="total.transAmount| currency:''"></span>元</div>
									<div class="col-sm-2 checkbox">赠送金额：<span ng-bind="total.giftAmount| currency:''"></span>元</div>
									<div class="col-sm-2 checkbox">可用金额：<span ng-bind="total.totalBalance | currency:''"></span>元</div>
									<div class="col-sm-2 checkbox">已使用金额：<span ng-bind="total.totalUseValue | currency:''"></span>元</div>
									<div class="col-sm-2 checkbox">过期金额：<span ng-bind="total.totalInvalidValue | currency:''"></span>元</div>
									<div class="col-sm-2 checkbox">总价值金额：<span ng-bind="total.totalFaceValue | currency:''"></span>元</div>
								</div>
								<div class="tposition">
									 <div ui-grid="gridOptions" ui-grid-pagination  ui-grid-resize-columns ui-grid-pinning class="grid"></div>
									<div ng-show="loadImg" class="timg"></div>
								</div>
							</div>
						</div>

						<form class="form-horizontal" id="form3" name="addCouponModal" novalidate>
							<div id="addCouponModal" class="modal fade" tabindex="-1" role="dialog">
								<div class="modal-dialog" style="width: 900px">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal">
												&times;</button>
											<h3 class="modal-title">新增券</h3>
										</div>
										<div class="modal-body">
											<div class="form-group">
												<label class="col-sm-3 control-label">参与活动：</label>
												<div class="col-sm-3">
													<select class="form-control" ng-change="actEntityList()" ng-model="addCoupon.couponCode" ng-options="x.value as x.text for x in couponCodes">
													</select>
												</div>
												<label class="col-sm-3 control-label">赠送券类型：</label>
												<div class="col-sm-3">
													<select class="form-control" ng-model="addCoupon.activityEntityId" ng-options="x.id as x.couponName for x in actEntitys">
													</select>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-3 control-label">赠送数量：</label>
												<div class="col-sm-3">
													<input type="text" class="form-control" ng-model="addCoupon.addNum" />
												</div>
												<label class="col-sm-3 control-label">关联交易订单号：</label>
												<div class="col-sm-3">
													<input type="text" class="form-control" ng-model="addCoupon.orderNo" />
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-3 control-label">赠送商户编号：</label>
												<div class="col-sm-3">
												<input type="text" class="form-control" ng-blur="merInfoQuery()" ng-model="addCoupon.merchantNo" />
													</div>
												<label class="col-sm-3 control-label">赠送商户名称：</label>
												<div class="col-sm-3">
												<div type="text"  class="form-control" ng-bind="addCoupon.merchantName" disabled="disabled" ></div>
													</div>
											</div>
											<div class="form-group">
												<label class="col-sm-5 control-label"></label>
												<div class="col-lg-12" align="center">
													<button class="btn btn-primary6" type="button" ng-click='addCouponSave()'>确认</button>
													<button class="btn btn-primary8" type="button" ng-click='addCouponModalHide()'>取消</button>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</form>

					</div>
				</div>
			</div>
	</form>
</div>